<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class TypeProf::LSP::Text - typeprof: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-analyze">#analyze</a>
    <li ><a href="#method-i-apply_changes">#apply_changes</a>
    <li ><a href="#method-i-code_complete">#code_complete</a>
    <li ><a href="#method-i-lines">#lines</a>
    <li ><a href="#method-i-locate_arg_index_in_signature_help">#locate_arg_index_in_signature_help</a>
    <li ><a href="#method-i-new_code_completion_session">#new_code_completion_session</a>
    <li ><a href="#method-i-on_text_changed">#on_text_changed</a>
    <li ><a href="#method-i-on_text_changed_analysis">#on_text_changed_analysis</a>
    <li ><a href="#method-i-push_analysis_queue">#push_analysis_queue</a>
    <li ><a href="#method-i-signature_help">#signature_help</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-TypeProf::LSP::Text">
    <h1 id="class-TypeProf::LSP::Text" class="class">
      class TypeProf::LSP::Text
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-caller_table" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">caller_table</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-definition_table" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">definition_table</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-sigs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">sigs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-text" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">text</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-version" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">version</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(server, uri, text, version)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">version</span>)
  <span class="ruby-ivar">@server</span> = <span class="ruby-identifier">server</span>
  <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">uri</span>
  <span class="ruby-ivar">@text</span> = <span class="ruby-identifier">text</span>
  <span class="ruby-ivar">@version</span> = <span class="ruby-identifier">version</span>
  <span class="ruby-ivar">@sigs</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-ivar">@last_analysis_cancel_token</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@analysis_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@analysis_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">work</span> = <span class="ruby-ivar">@analysis_queue</span>.<span class="ruby-identifier">pop</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">work</span>.<span class="ruby-identifier">call</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
        <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Rescued exception:&quot;</span>
        <span class="ruby-identifier">puts</span> <span class="ruby-identifier">$!</span>.<span class="ruby-identifier">full_message</span>
        <span class="ruby-identifier">puts</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># analyze synchronously to respond the first codeLens request</span>
  <span class="ruby-identifier">res</span>, <span class="ruby-identifier">def_table</span>, <span class="ruby-identifier">caller_table</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">analyze</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">text</span>)
  <span class="ruby-identifier">on_text_changed_analysis</span>(<span class="ruby-identifier">res</span>, <span class="ruby-identifier">def_table</span>, <span class="ruby-identifier">caller_table</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-analyze" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">analyze</span><span
                                class="method-args">(uri, text, cancel_token: nil, signature_help_loc: nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="analyze-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 277</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">analyze</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">text</span>, <span class="ruby-value">cancel_token:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">signature_help_loc:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">config</span> = <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">typeprof_config</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">path</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">rb_files</span> = [[<span class="ruby-identifier">path</span>, <span class="ruby-identifier">text</span>]]
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">rbs_files</span> = [<span class="ruby-string">&quot;typeprof.rbs&quot;</span>] <span class="ruby-comment"># XXX</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">verbose</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">max_sec</span> = <span class="ruby-value">1</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:show_errors</span>] = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:show_indicator</span>] = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:lsp</span>] = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">config</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:signature_help_loc</span>] = [<span class="ruby-identifier">path</span>, <span class="ruby-identifier">signature_help_loc</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">signature_help_loc</span>

  <span class="ruby-constant">TypeProf</span>.<span class="ruby-identifier">analyze</span>(<span class="ruby-identifier">config</span>, <span class="ruby-identifier">cancel_token</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">SyntaxError</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-apply_changes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">apply_changes</span><span
                                class="method-args">(changes, version)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="apply_changes-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">apply_changes</span>(<span class="ruby-identifier">changes</span>, <span class="ruby-identifier">version</span>)
  <span class="ruby-ivar">@definition_table</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">text</span> = <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> [] <span class="ruby-operator">:</span> <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>
  <span class="ruby-identifier">changes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">change</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">change</span>
    <span class="ruby-keyword">in</span> {
      <span class="ruby-value">range:</span> {
          <span class="ruby-value">start:</span> { <span class="ruby-value">line:</span> <span class="ruby-identifier">start_row</span>, <span class="ruby-value">character:</span> <span class="ruby-identifier">start_col</span> },
          <span class="ruby-value">end:</span>   { <span class="ruby-value">line:</span> <span class="ruby-identifier">end_row</span>  , <span class="ruby-value">character:</span> <span class="ruby-identifier">end_col</span>   }
      },
      <span class="ruby-value">text:</span> <span class="ruby-identifier">change_text</span>,
    }
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">start_row</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">end_row</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">start_row</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">end_row</span>
      <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span>][<span class="ruby-identifier">start_col</span><span class="ruby-operator">...</span><span class="ruby-identifier">end_col</span>] = <span class="ruby-identifier">change_text</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span>][<span class="ruby-identifier">start_col</span><span class="ruby-operator">..</span>] = <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-identifier">text</span>[<span class="ruby-identifier">end_row</span>][<span class="ruby-operator">...</span><span class="ruby-identifier">end_col</span>] = <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-identifier">change_text</span> = <span class="ruby-identifier">change_text</span>.<span class="ruby-identifier">lines</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">change_text</span>.<span class="ruby-identifier">size</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">0</span>
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">text</span>[<span class="ruby-identifier">end_row</span>]
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">..</span> <span class="ruby-identifier">end_row</span>] = []
      <span class="ruby-keyword">when</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">change_text</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">text</span>[<span class="ruby-identifier">end_row</span>]
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">..</span> <span class="ruby-identifier">end_row</span>] = []
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">change_text</span>.<span class="ruby-identifier">shift</span>
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">end_row</span>].<span class="ruby-identifier">prepend</span>(<span class="ruby-identifier">change_text</span>.<span class="ruby-identifier">pop</span>)
        <span class="ruby-identifier">text</span>[<span class="ruby-identifier">start_row</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">end_row</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] = <span class="ruby-identifier">change_text</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@text</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">join</span>
  <span class="ruby-ivar">@version</span> = <span class="ruby-identifier">version</span>

  <span class="ruby-identifier">on_text_changed</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-code_complete" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">code_complete</span><span
                                class="method-args">(loc, trigger_kind)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="code_complete-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 161</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">code_complete</span>(<span class="ruby-identifier">loc</span>, <span class="ruby-identifier">trigger_kind</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">loc</span>
  <span class="ruby-keyword">in</span> { <span class="ruby-value">line:</span> <span class="ruby-identifier">row</span>, <span class="ruby-value">character:</span> <span class="ruby-identifier">col</span> }
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">row</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">col</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>[<span class="ruby-identifier">row</span>][<span class="ruby-value">0</span>, <span class="ruby-identifier">col</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\.\w*$/</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">start_offset</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>)
  <span class="ruby-identifier">end_offset</span> = <span class="ruby-node">$&amp;</span>.<span class="ruby-identifier">size</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">trigger_kind</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">LSP</span><span class="ruby-operator">::</span><span class="ruby-constant">CompletionTriggerKind</span><span class="ruby-operator">::</span><span class="ruby-constant">TRIGGER_FOR_INCOMPLETE_COMPLETIONS</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@current_completion_session</span>&amp;.<span class="ruby-identifier">reusable?</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">start_offset</span>)
      <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;no reusable completion session but got TRIGGER_FOR_INCOMPLETE_COMPLETIONS&quot;</span>
      <span class="ruby-ivar">@current_completion_session</span> = <span class="ruby-identifier">new_code_completion_session</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">start_offset</span>, <span class="ruby-identifier">end_offset</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> <span class="ruby-ivar">@current_completion_session</span>.<span class="ruby-identifier">results</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@current_completion_session</span> = <span class="ruby-identifier">new_code_completion_session</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">start_offset</span>, <span class="ruby-identifier">end_offset</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-ivar">@current_completion_session</span>&amp;.<span class="ruby-identifier">results</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-lines" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">lines</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="lines-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lines</span>
  <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-new_code_completion_session" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new_code_completion_session</span><span
                                class="method-args">(row, start_offset, end_offset)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new_code_completion_session-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_code_completion_session</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">start_offset</span>, <span class="ruby-identifier">end_offset</span>)
  <span class="ruby-identifier">lines</span> = <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>
  <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">row</span>][<span class="ruby-identifier">start_offset</span>, <span class="ruby-identifier">end_offset</span>] = <span class="ruby-string">&quot;.__typeprof_lsp_completion&quot;</span>
  <span class="ruby-identifier">tmp_text</span> = <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>
  <span class="ruby-identifier">res</span>, = <span class="ruby-identifier">analyze</span>(<span class="ruby-ivar">@uri</span>, <span class="ruby-identifier">tmp_text</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">res</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">res</span>[<span class="ruby-value">:completion</span>]
    <span class="ruby-identifier">results</span> = <span class="ruby-identifier">res</span>[<span class="ruby-value">:completion</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
      {
        <span class="ruby-value">label:</span> <span class="ruby-identifier">name</span>,
        <span class="ruby-value">kind:</span> <span class="ruby-value">2</span>, <span class="ruby-comment"># Method</span>
      }
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">CompletionSession</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">results</span>, <span class="ruby-identifier">row</span>, <span class="ruby-identifier">start_offset</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-on_text_changed" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_text_changed</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_text_changed-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 297</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_text_changed</span>
  <span class="ruby-identifier">cancel_token</span> = <span class="ruby-constant">AnalysisToken</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@last_analysis_cancel_token</span>&amp;.<span class="ruby-identifier">cancel</span>
  <span class="ruby-ivar">@last_analysis_cancel_token</span> = <span class="ruby-identifier">cancel_token</span>

  <span class="ruby-identifier">uri</span> = <span class="ruby-ivar">@uri</span>
  <span class="ruby-identifier">text</span> = <span class="ruby-ivar">@text</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">push_analysis_queue</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">cancel_token</span>.<span class="ruby-identifier">cancelled?</span>
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">res</span>, <span class="ruby-identifier">def_table</span>, <span class="ruby-identifier">caller_table</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">analyze</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">text</span>, <span class="ruby-value">cancel_token:</span> <span class="ruby-identifier">cancel_token</span>)
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">cancel_token</span>.<span class="ruby-identifier">cancelled?</span>
      <span class="ruby-identifier">on_text_changed_analysis</span>(<span class="ruby-identifier">res</span>, <span class="ruby-identifier">def_table</span>, <span class="ruby-identifier">caller_table</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-on_text_changed_analysis" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_text_changed_analysis</span><span
                                class="method-args">(res, definition_table, caller_table)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_text_changed_analysis-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 315</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_text_changed_analysis</span>(<span class="ruby-identifier">res</span>, <span class="ruby-identifier">definition_table</span>, <span class="ruby-identifier">caller_table</span>)
  <span class="ruby-ivar">@definition_table</span> = <span class="ruby-identifier">definition_table</span>
  <span class="ruby-ivar">@caller_table</span> = <span class="ruby-identifier">caller_table</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>

  <span class="ruby-ivar">@sigs</span> = []
  <span class="ruby-identifier">res</span>[<span class="ruby-value">:sigs</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span>, <span class="ruby-identifier">lineno</span>, <span class="ruby-identifier">sig_str</span>, <span class="ruby-identifier">rbs_code_range</span>, <span class="ruby-identifier">class_kind</span>, <span class="ruby-identifier">class_name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">uri0</span> = <span class="ruby-string">&quot;file://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@uri</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri0</span>
      <span class="ruby-identifier">command</span> = { <span class="ruby-value">title:</span> <span class="ruby-identifier">sig_str</span> }
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">rbs_code_range</span>
        <span class="ruby-identifier">command</span>[<span class="ruby-value">:command</span>] = <span class="ruby-string">&quot;typeprof.jumpToRBS&quot;</span>
        <span class="ruby-identifier">command</span>[<span class="ruby-value">:arguments</span>] = [<span class="ruby-identifier">uri0</span>, { <span class="ruby-value">line:</span> <span class="ruby-identifier">lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, <span class="ruby-value">character:</span> <span class="ruby-value">0</span> }, <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">root_uri</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">rbs_code_range</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">rbs_code_range</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_lsp</span>]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">command</span>[<span class="ruby-value">:command</span>] = <span class="ruby-string">&quot;typeprof.createPrototypeRBS&quot;</span>
        <span class="ruby-identifier">command</span>[<span class="ruby-value">:arguments</span>] = [<span class="ruby-identifier">class_kind</span>, <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">sig_str</span>]
      <span class="ruby-keyword">end</span>
      <span class="ruby-ivar">@sigs</span> <span class="ruby-operator">&lt;&lt;</span> {
        <span class="ruby-value">range:</span> {
          <span class="ruby-value">start:</span> { <span class="ruby-value">line:</span> <span class="ruby-identifier">lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, <span class="ruby-value">character:</span> <span class="ruby-value">0</span> },
          <span class="ruby-value">end:</span> { <span class="ruby-value">line:</span> <span class="ruby-identifier">lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, <span class="ruby-value">character:</span> <span class="ruby-value">1</span> },
        },
        <span class="ruby-value">command:</span> <span class="ruby-identifier">command</span>,
      }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">diagnostics</span> = {}
  <span class="ruby-identifier">res</span>[<span class="ruby-value">:errors</span>]&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">code_range</span>), <span class="ruby-identifier">msg</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">file</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">code_range</span>
    <span class="ruby-identifier">uri0</span> = <span class="ruby-string">&quot;file://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file</span>
    <span class="ruby-identifier">diagnostics</span>[<span class="ruby-identifier">uri0</span>] <span class="ruby-operator">||=</span> []
    <span class="ruby-identifier">diagnostics</span>[<span class="ruby-identifier">uri0</span>] <span class="ruby-operator">&lt;&lt;</span> {
      <span class="ruby-value">range:</span> <span class="ruby-identifier">code_range</span>.<span class="ruby-identifier">to_lsp</span>,
      <span class="ruby-value">severity:</span> <span class="ruby-value">1</span>,
      <span class="ruby-value">source:</span> <span class="ruby-string">&quot;TypeProf&quot;</span>,
      <span class="ruby-value">message:</span> <span class="ruby-identifier">msg</span>,
    }
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">send_notification</span>(<span class="ruby-string">&#39;typeprof.enableToggleButton&#39;</span>)
  <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">send_request</span>(<span class="ruby-string">&quot;workspace/codeLens/refresh&quot;</span>)

  <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">send_notification</span>(
    <span class="ruby-string">&quot;textDocument/publishDiagnostics&quot;</span>,
    {
      <span class="ruby-value">uri:</span> <span class="ruby-ivar">@uri</span>,
      <span class="ruby-value">version:</span> <span class="ruby-identifier">version</span>,
      <span class="ruby-value">diagnostics:</span> <span class="ruby-identifier">diagnostics</span>[<span class="ruby-ivar">@uri</span>] <span class="ruby-operator">||</span> [],
    }
  )
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-push_analysis_queue" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">push_analysis_queue</span><span
                                class="method-args">(&amp;work)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="push_analysis_queue-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 293</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">push_analysis_queue</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">work</span>)
  <span class="ruby-ivar">@analysis_queue</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">work</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-signature_help" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">signature_help</span><span
                                class="method-args">(loc, trigger_kind)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="signature_help-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 250</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">signature_help</span>(<span class="ruby-identifier">loc</span>, <span class="ruby-identifier">trigger_kind</span>)
  <span class="ruby-identifier">loc</span> = <span class="ruby-constant">CodeLocation</span>.<span class="ruby-identifier">from_lsp</span>(<span class="ruby-identifier">loc</span>)

  <span class="ruby-identifier">res</span>, = <span class="ruby-identifier">analyze</span>(<span class="ruby-ivar">@uri</span>, <span class="ruby-ivar">@text</span>, <span class="ruby-value">signature_help_loc:</span> <span class="ruby-identifier">loc</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">res</span>
    <span class="ruby-identifier">res</span>[<span class="ruby-value">:signature_help</span>].<span class="ruby-identifier">filter_map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sig_str</span>, <span class="ruby-identifier">sig_help</span>, <span class="ruby-identifier">node_id</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">node</span> = <span class="ruby-constant">ISeq</span>.<span class="ruby-identifier">find_node_by_id</span>(<span class="ruby-ivar">@text</span>, <span class="ruby-identifier">node_id</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">ISeq</span>.<span class="ruby-identifier">code_range_from_node</span>(<span class="ruby-identifier">node</span>).<span class="ruby-identifier">contain_loc?</span>(<span class="ruby-identifier">loc</span>)
        <span class="ruby-identifier">idx</span> = <span class="ruby-identifier">locate_arg_index_in_signature_help</span>(<span class="ruby-identifier">node</span>, <span class="ruby-identifier">loc</span>, <span class="ruby-identifier">sig_help</span>)

        {
          <span class="ruby-value">label:</span> <span class="ruby-identifier">sig_str</span>,
          <span class="ruby-value">parameters:</span> <span class="ruby-identifier">sig_help</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
            {
              <span class="ruby-value">label:</span> [<span class="ruby-identifier">r</span>.<span class="ruby-identifier">begin</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">end</span>],
            }
          <span class="ruby-keyword">end</span>,
          <span class="ruby-value">activeParameter:</span> <span class="ruby-identifier">idx</span>,
        }
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-locate_arg_index_in_signature_help" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">locate_arg_index_in_signature_help</span><span
                                class="method-args">(node, loc, sig_help)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="locate_arg_index_in_signature_help-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/lsp.rb, line 184</span>
        <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locate_arg_index_in_signature_help</span>(<span class="ruby-identifier">node</span>, <span class="ruby-identifier">loc</span>, <span class="ruby-identifier">sig_help</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:FCALL</span>
    <span class="ruby-identifier">_mid</span>, <span class="ruby-identifier">args_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CALL</span>
    <span class="ruby-identifier">_recv</span>, <span class="ruby-identifier">_mid</span>, <span class="ruby-identifier">args_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">idx</span> = <span class="ruby-value">0</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">args_node</span>
    <span class="ruby-identifier">arg_nodes</span> = <span class="ruby-identifier">args_node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">compact</span>

    <span class="ruby-identifier">arg_indexes</span> = {}
    <span class="ruby-identifier">hash</span> = <span class="ruby-identifier">arg_nodes</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg_nodes</span>.<span class="ruby-identifier">last</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:HASH</span>

    <span class="ruby-identifier">arg_nodes</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
      <span class="ruby-comment"># Ingore arguments after rest argument</span>
      <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIST</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:ARGSCAT</span>

      <span class="ruby-identifier">arg_indexes</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-constant">ISeq</span>.<span class="ruby-identifier">code_range_from_node</span>(<span class="ruby-identifier">node</span>)
    <span class="ruby-keyword">end</span>

    <span class="ruby-comment"># Handle keyword arguments</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">hash</span>
      <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node1</span>, <span class="ruby-identifier">node2</span><span class="ruby-operator">|</span>
        <span class="ruby-comment"># key:  expression</span>
        <span class="ruby-comment"># ^^^^  ^^^^^^^^^^</span>
        <span class="ruby-comment"># node1 node2</span>
        <span class="ruby-identifier">key</span> = <span class="ruby-identifier">node1</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>
        <span class="ruby-identifier">arg_indexes</span>[<span class="ruby-identifier">key</span>] =
          <span class="ruby-constant">CodeRange</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-constant">CodeLocation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">node1</span>.<span class="ruby-identifier">first_lineno</span>, <span class="ruby-identifier">node1</span>.<span class="ruby-identifier">first_lineno</span>),
            <span class="ruby-constant">CodeLocation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">node2</span>.<span class="ruby-identifier">last_lineno</span>, <span class="ruby-identifier">node2</span>.<span class="ruby-identifier">last_lineno</span>),
          )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg_indexes</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">arg_indexes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">loc</span>
      <span class="ruby-comment"># There is the cursor after the last argument: &quot;foo(111, 222,|)&quot;</span>
      <span class="ruby-identifier">idx</span> = <span class="ruby-identifier">arg_indexes</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
      <span class="ruby-identifier">prev_cr</span> = <span class="ruby-identifier">arg_indexes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">last</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">lineno</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">loc</span>.<span class="ruby-identifier">lineno</span>
        <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>[<span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
        <span class="ruby-identifier">idx</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">column</span><span class="ruby-operator">..</span><span class="ruby-identifier">loc</span>.<span class="ruby-identifier">column</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;,&quot;</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-comment"># There is the cursor within any argument: &quot;foo(111,|222)&quot; or foo(111, 22|2)&quot;</span>
      <span class="ruby-identifier">prev_cr</span> = <span class="ruby-keyword">nil</span>
      <span class="ruby-identifier">arg_indexes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span>, <span class="ruby-identifier">cr</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">idx</span> = <span class="ruby-identifier">sig_help</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">i</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">loc</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">cr</span>.<span class="ruby-identifier">first</span>
          <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">prev_cr</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">lineno</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">loc</span>.<span class="ruby-identifier">lineno</span>
          <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@text</span>.<span class="ruby-identifier">lines</span>[<span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
          <span class="ruby-identifier">idx</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">line</span>[<span class="ruby-identifier">prev_cr</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">column</span><span class="ruby-operator">..</span><span class="ruby-identifier">loc</span>.<span class="ruby-identifier">column</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;,&quot;</span>)
          <span class="ruby-keyword">break</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">loc</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">cr</span>.<span class="ruby-identifier">last</span>
        <span class="ruby-identifier">prev_cr</span> = <span class="ruby-identifier">cr</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">idx</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

